package model

import (
	"engine/consts"
	"gorm.io/datatypes"
)

type PublicSearchData struct {
	Query    string `json:"query" form:"query" extensions:"x-nullable"`
	Page     int    `json:"page" form:"page" default:"1"`
	PageSize int    `json:"pageSize" form:"pageSize" default:"30"`
}

type CNTrainStationSearchRequest struct {
	CityCode string                      `json:"cityCode" form:"cityCode"`
	Status   consts.CNTrainStationStatus `json:"status" form:"status" extensions:"x-nullable"`
	PublicSearchData
}

type CreateTrainStationRequest struct {
	Code string `json:"code" binding:"required"`
	UpdateTrainStationRequest
}

type UpdateTrainStationRequest struct {
	Code        string                      `json:"-"`
	Name        string                      `json:"name" binding:"required"`
	ChineseName string                      `json:"chineseName" binding:"required"`
	PinYin      string                      `json:"pinyin" binding:"required"`
	SaleTime    string                      `json:"saleTime"`
	CitiCode    string                      `json:"cityCode"`
	Address     string                      `json:"address"`
	Latitude    float64                     `json:"latitude"`
	Longitude   float64                     `json:"longitude"`
	Status      consts.CNTrainStationStatus `json:"status"`
	Locales     datatypes.JSON              `json:"locales"`
}

type AirportSearchRequest struct {
	CityCode    string              `json:"cityCode" form:"cityCode"`
	CountryCode string              `json:"countryCode" form:"countryCode"`
	Status      consts.CommonStatus `json:"status" form:"status" extensions:"x-nullable"`
	PublicSearchData
}

type CreateAirportRequest struct {
	Code        string              `json:"code" binding:"required"`
	IcaoCode    string              `json:"icaoCode"`
	CountryCode string              `json:"countryCode"`
	CityCode    string              `json:"cityCode"`
	Name        string              `json:"name" binding:"required"`
	ChineseName string              `json:"chineseName" binding:"required"`
	Locales     datatypes.JSON      `json:"locales"`
	Timezone    string              `json:"timezone"`
	Latitude    float64             `json:"latitude"`
	Longitude   float64             `json:"longitude"`
	Status      consts.CommonStatus `json:"status"`
}

type UpdateAirportRequest struct {
	Code        string              `json:"-"`
	IcaoCode    string              `json:"icaoCode"`
	CountryCode string              `json:"countryCode"`
	CityCode    string              `json:"cityCode"`
	Name        string              `json:"name" binding:"required"`
	ChineseName string              `json:"chineseName" binding:"required"`
	Locales     datatypes.JSON      `json:"locales"`
	Timezone    string              `json:"timezone"`
	Latitude    float64             `json:"latitude"`
	Longitude   float64             `json:"longitude"`
	Status      consts.CommonStatus `json:"status"`
}

type CitySearchRequest struct {
	CountryCode string              `json:"countryCode" form:"countryCode"`
	Status      consts.CommonStatus `json:"status" form:"status" extensions:"x-nullable"`
	PublicSearchData
}

type CreateCityRequest struct {
	Code        string              `json:"code" binding:"required"`
	CountryCode string              `json:"countryCode"`
	Name        string              `json:"name" binding:"required"`
	ChineseName string              `json:"chineseName"`
	Locales     datatypes.JSON      `json:"locales"`
	Status      consts.CommonStatus `json:"status"`
}

type UpdateCityRequest struct {
	Code        string              `json:"-"`
	CountryCode string              `json:"countryCode"`
	Name        string              `json:"name" binding:"required"`
	ChineseName string              `json:"chineseName"`
	Locales     datatypes.JSON      `json:"locales"`
	Status      consts.CommonStatus `json:"status"`
}

type CountrySearchRequest struct {
	ContinentCode string              `json:"continentCode" form:"continentCode"`
	Status        consts.CommonStatus `json:"status" form:"status" extensions:"x-nullable"`
	PublicSearchData
}

type CreateCountryRequest struct {
	Code          string              `json:"code" binding:"required"`
	ContinentCode string              `json:"continentCode"`
	Alpha3        string              `json:"alpha3"`
	Name          string              `json:"name" binding:"required"`
	ChineseName   string              `json:"chineseName"`
	Locales       datatypes.JSON      `json:"locales"`
	Region        int                 `json:"region"`
	Currency      string              `json:"currency"`
	Symbol        string              `json:"symbol"`
	Status        consts.CommonStatus `json:"status"`
}

type UpdateCountryRequest struct {
	Code          string              `json:"-"`
	ContinentCode string              `json:"continentCode"`
	Alpha3        string              `json:"alpha3"`
	Name          string              `json:"name" binding:"required"`
	ChineseName   string              `json:"chineseName"`
	Locales       datatypes.JSON      `json:"locales"`
	Region        int                 `json:"region"`
	Currency      string              `json:"currency"`
	Symbol        string              `json:"symbol"`
	Status        consts.CommonStatus `json:"status"`
}

type AirlineSearchRequest struct {
	Status consts.CommonStatus `json:"status" form:"status" extensions:"x-nullable"`
	PublicSearchData
}

type CreateAirlineRequest struct {
	Code           string              `json:"code" binding:"required"`
	IataAccounting string              `json:"iataAccounting"`
	IcaoCode       string              `json:"icaoCode"`
	CountryCode    string              `json:"countryCode"`
	Name           string              `json:"name" binding:"required"`
	ChineseName    string              `json:"chineseName"`
	Locales        datatypes.JSON      `json:"locales"`
	Callsign       string              `json:"callsign"`
	Website        string              `json:"website"`
	Status         consts.CommonStatus `json:"status"`
}

type UpdateAirlineRequest struct {
	Code           string              `json:"-"`
	IataAccounting string              `json:"iataAccounting"`
	IcaoCode       string              `json:"icaoCode"`
	CountryCode    string              `json:"countryCode"`
	Name           string              `json:"name" binding:"required"`
	ChineseName    string              `json:"chineseName"`
	Locales        datatypes.JSON      `json:"locales"`
	Callsign       string              `json:"callsign"`
	Website        string              `json:"website"`
	Status         consts.CommonStatus `json:"status"`
}
